﻿namespace WMS6.Web.Inventory
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class LpnQuery : BasePage
    {
        protected Button btnList;
        protected Button btnSearch;
        protected CheckBox cbxHistory;
        protected DropDownList ddlDocID;
        protected DropDownList ddlDocType;
        protected DropDownList ddlDocTypeValue;
        protected DropDownList ddlExternID;
        protected DropDownList ddlIsActive;
        protected DropDownList ddlIsActiveOper;
        protected DropDownList ddlLpnID;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlPackID;
        protected DropDownList ddlSkuID;
        protected HtmlForm F5075;
        protected HtmlInputHidden hdnActionID;
        protected HtmlHead Head1;
        protected Label lblDocID;
        protected Label lblDocType;
        protected Label lblExternID;
        protected Label lblIsActive;
        protected Label lblLpnID;
        protected Label lblLpnQuery;
        protected Label lblOwnerID;
        protected Label lblPackID;
        protected Label lblSkuID;
        protected HtmlLink mycss;
        protected TextBox txtDocID;
        protected TextBox txtExternID;
        protected TextBox txtLpnID;
        protected TextBox txtOwnerID;
        protected TextBox txtPackID;
        protected TextBox txtSkuID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("LpnList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("LpnList.aspx?action=" + base.UrlEncode(this.hdnActionID.Value), false);
        }

        private void LoadDDl()
        {
            base.InitQueryDDL(this.ddlLpnID, 0);
            base.InitQueryDDL(this.ddlDocID, 0);
            base.InitQueryDDL(this.ddlDocType, 0);
            base.InitQueryDDL(this.ddlPackID, 0);
            base.InitQueryDDL(this.ddlExternID, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.InitQueryDDL(this.ddlIsActiveOper, 0);
            base.InitIsActiveDDL(this.ddlIsActive, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDDl();
            }
        }

        public string DocID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDocID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDocID.Text.Trim(), this.ddlDocID.SelectedValue);
                }
                return "";
            }
        }

        public string DocType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlDocTypeValue.Text.Trim()))
                {
                    return base.GetParamsString(this.ddlDocTypeValue.Text.Trim(), this.ddlDocType.SelectedValue);
                }
                return "";
            }
        }

        public string ExternID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternID.Text.Trim(), this.ddlExternID.SelectedValue);
                }
                return "";
            }
        }

        public string History
        {
            get
            {
                if (this.cbxHistory.Checked)
                {
                    return "Y";
                }
                return "N";
            }
        }

        public string IsActive
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsActive.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsActive.SelectedValue, this.ddlIsActiveOper.SelectedValue);
                }
                return "";
            }
        }

        public string LpnID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLpnID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLpnID.Text.Trim(), this.ddlLpnID.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string PackID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtPackID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtPackID.Text.Trim(), this.ddlLpnID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuID.SelectedValue);
                }
                return "";
            }
        }
    }
}

